import router from './routes/route';
import { RouterProvider } from "react-router-dom";
import { ErrorBoundaryWithContext,CustomErrorPage } from './components';
import { MessageProvider } from './hooks/MessageHook';
import { AuthProvider } from './hooks';

function App() {
  return (
    <MessageProvider>
      <ErrorBoundaryWithContext fallback={(err)=><CustomErrorPage error={err}/>}>   
        <AuthProvider>  
          <RouterProvider router={router} fallbackElement={<p>Loading...</p>}></RouterProvider>
        </AuthProvider>
      </ErrorBoundaryWithContext>
    </MessageProvider>
  );
}

export default App;

